attribute vec3 aVertexPosition;
attribute vec3 aVertexNorm;
attribute vec2 aTextureCoord;

uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
uniform mat4 uNMatrix;

uniform vec3 uAmbLightColor;
uniform vec3 uDirLightDiffColor;
uniform vec3 uDirLightVect;

varying vec2 vTextureCoord;
varying vec3 vLightWeight;

void main(void) {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
    vTextureCoord = aTextureCoord;
    vec4 cameraSpaceNorm = uNMatrix * vec4(aVertexNorm, 0.0);
    float diffWeight = max(dot(cameraSpaceNorm.xyz, -uDirLightVect), 0.0);
    vLightWeight = uAmbLightColor + uDirLightDiffColor * diffWeight;
}
